SuperStrict

' RegEx wrapper for lexer

' Wraps BaH.RegEx

Import BaH.RegEx

Extern
Function RegEx_Create:TRegEx(pattern:String, o:Object = Null) = "_bah_regex_TRegEx_Create"
End Extern

Function RegEx_Match:Int(r:TRegEx, b:Byte Ptr, s:Int Var, l:Int Var)
	Local t:String = String.FromUTF8String(b)
	Local m:TRegExMatch = r.Find(t, 0)
	If Not m Return False
	s = m.SubStart()
	l = m.SubEnd() - s	's=0 for lexer.bmx but subtracting for correctness
	Return True
End Function
